package twoscreen;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class SwitchTwoScreen extends Application{
	
	Stage window;
	Scene scence1,scence2;
	
	public static void main(String[] args) {
		launch(args);
		
	}
	

	@Override
	public void start(Stage primaryStage) throws Exception {
		// TODO Auto-generated method stub
		window=primaryStage;
		Label label1=new Label("第一个页面");
		
		Button button1=new Button("到第二个页面");
		button1.setOnAction(e->window.setScene(scence2));
		//Layout1
		VBox layout1=new VBox(20);
		layout1.getChildren().addAll(label1,button1);
		scence1=new Scene(layout1,200,200);
		
		//Button2
		Button button2=new Button("到第一个页面");
		button2.setOnAction(e->window.setScene(scence1));
		StackPane layout2=new StackPane();
		layout2.getChildren().add(button2);
		scence2=new Scene(layout2,300,300);
		window.setScene(scence1);
		window.setTitle("jk");
		window.show();
		
		
		
	}

}
